import { Layout, ConfigProvider } from 'antd';
import Header from 'components/layouts/header';
import zhCN from 'antd/es/locale/zh_CN';

const { Content } = Layout;

export default function BaseLayout({ children, location }) {
  const { pathname } = location;
  return (
    <Layout style={{ height: '100%', display: 'flex', flexDirection: 'column' }}>
      { pathname === '/' ? ( <Content>{children}</Content> ) : (
        <>
          <Header />
          <Layout>
            <Content
              className="site-layout-background"
              style={{
                padding: 20,
                margin: 0,
              }}
            >
              <ConfigProvider locale={zhCN}>{children}</ConfigProvider>
            </Content>
          </Layout>
        </>
      )}
    </Layout>
  );
}
